#ifndef QxDatabasePool_HPP
#define QxDatabasePool_HPP

#include <QObject>

#include <QSqlDatabase>

class QxDatabasePool : public QObject
{
  Q_OBJECT

public:

  static QxDatabasePool& instance();
  ~QxDatabasePool();

  const QSqlDatabase& database() const;
  void setDatabase( const QSqlDatabase& );

  static bool init();
  static void finish();

Q_SIGNALS:

  void databaseChanged( const QSqlDatabase& );

private:

  QxDatabasePool();

  class QxDatabasePoolPrivate;
  QScopedPointer<QxDatabasePoolPrivate>         _pd;
};

#define theDatabasePool QxDatabasePool::instance()

#endif // QxDatabasePool_HPP
